<?php

namespace App\Http\Controllers\Api\v1;

use App\common;
use App\Http\Controllers\Controller;
use App\Logic\MortgageLogic;
use Illuminate\Http\Request;

class MortgageController extends Controller
{
    //
      //等额本息
      function debx()
      {
          $money=request()->get('money'); //贷款金额
          $month=request()->get('month');//贷款月
          $dknl=request()->get('dknl');//贷款年利率
          try {
                $data=MortgageLogic::debx($month,$money,$dknl);
                return common::success(20000,$data,'成功');
          }catch (\Exception $exception){
                return common::fail("","",$exception->getMessage());
          }
      }

      //等额本金
      function debj()
      {
          $money=request()->get('money');
          $month=request()->get('month');
          $dknl=request()->get('dknl');
          try {
              $data=MortgageLogic::debj($money,$month,$dknl);
              return common::success(20000,$data,'成功');
          }catch (\Exception $exception){
              return common::fail("","",$exception->getMessage());
          }
      }

}
